import { DoubleSide, Group, Mesh, MeshBasicMaterial, PlaneBufferGeometry, TextureLoader, Vector3 } from 'three';
// 光柱
export class CreateColumn {
    private geometry!: PlaneBufferGeometry;
    private metrial!: MeshBasicMaterial;
    group!: Group;
    mesh!: Mesh;
    constructor(height) {
        this.group = new Group();
        this.geometry = new PlaneBufferGeometry(1, height);
        this.geometry.rotateX(Math.PI / 2);
        this.geometry.translate(0, 0, height/2);
        this.metrial = new MeshBasicMaterial({
            map: new TextureLoader().load('../assets/光柱.png'),
            color: 0x99ffaa,
            transparent: true,
            side: DoubleSide,
            depthWrite: false
        });


    }

    getColumn(log, lat) {
        this.mesh = new Mesh(this.geometry, this.metrial);
        this.mesh.position.set(log, lat, 0);
        this.group.add(this.mesh, this.mesh.clone().rotateZ(Math.PI / 2));
        return this.group;
    }
}